<?php
/**
 * Created by PhpStorm.
 * User: Aliaksei Lazerka
 * Date: 10/6/14
 * Time: 8:57 PM
 */

namespace sql;

if (!defined('NYMPH_ROOT')) {
  define('NYMPH_ROOT', dirname("../../" . __FILE__));
  require(NYMPH_ROOT . '/local/loader/kernel/classes/URLClassLoader.php');
}

/**
 * Used for converting queries with params
 */
class ParamResolver
{

  /**
   * (PHP 5)<br/>
   * Is used for converting query
   * @param string $query
   * @param Params $params
   * @return string query
   */
  public static function resolveQuery($query, $params)
  {
    if ($query != null) {
      $separator = $params->getSeparator();
      foreach ($params->getParams() as $key => $value) {
        $query = str_replace($separator . $key, $value, $query);
      }
    }
    return $query;
  }
} 